Skip to content

Explicit parameter binding - #1009

Closed
KathleenDollard wants to merge 11 commits into
dotnet:masterfrom
KathleenDollard:explicit-parameter-binding-3
Closed

Explicit parameter binding#1009
KathleenDollard wants to merge 11 commits into
dotnet:masterfrom
KathleenDollard:explicit-parameter-binding-3

Conversation

@KathleenDollard

Copy link
Copy Markdown
Contributor

Allows differently named parameters and paired options/arguments

@KathleenDollard

Copy link
Copy Markdown
Contributor Author

Fixes #952

Comment on lines 213 to 217
if (parameterDescriptor.HasDefaultValue)
boundValue = BoundValue.DefaultForValueDescriptor(parameterDescriptor);
else if (parameterDescriptor.AllowsNull &&
else if (parameterDescriptor.AllowsNull &&
ShouldPassNullToConstructor(constructorDescriptor.Parent, constructorDescriptor))
boundValue = BoundValue.DefaultForType(valueDescriptor);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this block should also be part of the extracted GetBoundValue method.

// check for nulls
if (!(handler is ModelBindingCommandHandler bindingHandler))
{
throw new InvalidOperationException("Cannot bind to this type of handler");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just make ModelBindingCommandHandler public?

@KathleenDollard

Copy link
Copy Markdown
Contributor Author

Replaced with #1018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants